home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / jasperCallback.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  27.2 KB  |  965 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // ================= Callbacks for each section ======================
  18. global proc jasperTabMenuChange( 
  19.     string $jasperCommand, 
  20.     string $parent 
  21. )
  22. {
  23.     string $currentTab = `tabLayout -query -selectTab $parent`;
  24.  
  25.     if( $currentTab == "Sculpt" 
  26.         || $currentTab == "Weight"
  27.         || $currentTab == "Script_Paint"
  28.         || attrPaintInstCheckCurrentTab($currentTab) )
  29.     {
  30.         string $cmd;
  31.  
  32.         $cmd = ($jasperCommand + " -q -brushoperate `currentCtx`");
  33.         string $type = `eval $cmd`;
  34.         if ( ( $type != "paint" )
  35.              && ( eval( "floatSliderGrp -ex commEdgesTol" ) )
  36.              && ( eval( "floatSliderGrp -ex collapseCVTol" ) ) ) 
  37.         {
  38.             $cmd = $jasperCommand + "-e -brushoperate \"paint\" `currentCtx`";
  39.             eval $cmd;
  40.             updateCommEdgeDisplayScreen $jasperCommand;
  41.             radioButtonGrp -e -sl 1 brushOperationType;
  42.         }
  43.     } 
  44. }
  45.  
  46. global proc updateBrushShapeIcons( 
  47.     string $selectType 
  48. )
  49. {
  50.     symbolCheckBox -e -v false bsCirclePoly;
  51.     symbolCheckBox -e -v false bsCircleGaus;
  52.     symbolCheckBox -e -v false bsCircleSolid;
  53.     symbolCheckBox -e -v false bsSemiCirclePoly;
  54.     symbolCheckBox -e -v false bsSemiCircleSolid;
  55.     symbolCheckBox -e -v false bsRect;
  56.     symbolCheckBox -e -v false bsLineH;
  57.     symbolCheckBox -e -v false bsLineV;
  58.  
  59.     switch( $selectType ) {
  60.     case "-byCirclePoly":
  61.         symbolCheckBox -e -v true  bsCirclePoly;
  62.         break;
  63.     case "-byCircleGaus":
  64.         symbolCheckBox -e -v true  bsCircleGaus;
  65.         break;
  66.     case "-byCircleSolid":
  67.         symbolCheckBox -e -v true  bsCircleSolid;
  68.         break;
  69.     case "-bySemiCirclePoly":
  70.         symbolCheckBox -e -v true  bsSemiCirclePoly;
  71.         break;
  72.     case "-bySemiCircleSolid":
  73.         symbolCheckBox -e -v true  bsSemiCircleSolid;
  74.         break;
  75.     case "-byRect":
  76.         symbolCheckBox -e -v true  bsRect;
  77.         break;
  78.     case "-byLineH":
  79.         symbolCheckBox -e -v true  bsLineH;
  80.         break;
  81.     case "-byLineV":
  82.         symbolCheckBox -e -v true  bsLineV;
  83.         break;
  84.     }
  85. }
  86.  
  87. global proc resetTabletAttr( )
  88. {
  89.     // initialize the scaling factor for tablet variable
  90.     setInputDeviceMapping -d "tablet" -ax "pen:tilt:X" -s 1 -o 0 -a  -w ;
  91.     setInputDeviceMapping -d "tablet" -ax "pen:tilt:Y" -s 1 -o 0 -a  -w ;
  92.     setInputDeviceMapping -d "tablet" -ax "pen:penID"  -s 1 -o 0 -a  -w ;
  93. }
  94.  
  95. global proc jasperSetLowerRadius( string $jasperCommand )
  96. {
  97.     float $radius      = `floatSliderGrp -q -v radius`;
  98.     float $lowerRadius = `floatSliderGrp -q -v lowerRadius`;
  99.  
  100.     if( $lowerRadius > $radius ) {
  101.         floatSliderGrp -e -v $radius lowerRadius;
  102.     }
  103. }
  104.  
  105.  
  106. global proc jasperSetRadius( string $jasperCommand )
  107. {
  108.     float $radius      = `floatSliderGrp -q -v radius`;
  109.     float $lowerRadius = `floatSliderGrp -q -v lowerRadius`;
  110.  
  111.     if( $lowerRadius > $radius ) {
  112.         floatSliderGrp -e -v $lowerRadius radius;
  113.     }
  114. }
  115.  
  116. global proc jasperStampProfileCallback( 
  117.     string $jasperCommand,
  118.     string $parent,
  119.     string $currentTool 
  120. )
  121. {
  122.     // 
  123.     // Profile frameLayout
  124.     //
  125.     floatSliderGrp -e -cc ($jasperCommand + " -e -lowerradius #1 `currentCtx`")
  126.         -dc ( "jasperSetLowerRadius " + $jasperCommand ) 
  127.         lowerRadius;
  128.     floatSliderGrp -e -cc ($jasperCommand + " -e -radius #1 `currentCtx`")
  129.         -dc ( "jasperSetRadius " + $jasperCommand ) 
  130.         radius;
  131.  
  132.  
  133.     if ( ( $currentTool != "selectPaint" ) && ( $currentTool != "setEditPaint" ) ) {
  134.         floatSliderGrp -e
  135.             -cc ($jasperCommand + " -e -opacity #1 `currentCtx`")
  136.             opacitySlider;
  137.  
  138.         if ( $currentTool == "wtPaint" || $currentTool == "userPaint"
  139.              || $currentTool == "attrPaint"
  140.              || attrPaintInstCheckTool( $currentTool ) )
  141.         {
  142.             floatSliderGrp -e
  143.                 -cc ($jasperCommand + " -e -color #1 #1 #1 `currentCtx`")
  144.                 colorSlider;
  145.         }
  146.  
  147.         button -e
  148.             -c   ($jasperCommand + " -e -clear `currentCtx`" )
  149.             floodButton;
  150.     }
  151.  
  152.  
  153.     symbolCheckBox -e
  154.         -cc ($jasperCommand + " -e -brushshape circle1 `currentCtx`; updateBrushShapeIcons -byCirclePoly") 
  155.         bsCirclePoly;
  156.     symbolCheckBox -e
  157.         -cc ($jasperCommand + " -e -brushshape circle2 `currentCtx`; updateBrushShapeIcons -byCircleGaus") 
  158.         bsCircleGaus;
  159.     symbolCheckBox -e
  160.         -cc ($jasperCommand + " -e -brushshape circle3 `currentCtx`; updateBrushShapeIcons -byCircleSolid") 
  161.         bsCircleSolid;
  162.     symbolCheckBox -e
  163.         -cc ($jasperCommand + " -e -brushshape semiCircle1 `currentCtx`; updateBrushShapeIcons -bySemiCirclePoly") 
  164.         bsSemiCirclePoly;
  165.     symbolCheckBox -e
  166.         -cc ($jasperCommand + " -e -brushshape semiCircle2 `currentCtx`; updateBrushShapeIcons -bySemiCircleSolid") 
  167.         bsSemiCircleSolid;
  168.     symbolCheckBox -e
  169.         -cc ($jasperCommand + " -e -brushshape rectangle `currentCtx`; updateBrushShapeIcons -byRect") 
  170.         bsRect;
  171.     symbolCheckBox -e
  172.         -cc ($jasperCommand + " -e -brushshape lineH `currentCtx`; updateBrushShapeIcons -byLineH") 
  173.         bsLineH;
  174.     symbolCheckBox -e
  175.         -cc ($jasperCommand + " -e -brushshape lineV `currentCtx`; updateBrushShapeIcons -byLineV") 
  176.         bsLineV;
  177.  
  178. }
  179.  
  180.  
  181. global proc jasperValueCallback( 
  182.     string $jasperCommand, 
  183.     string $parent,
  184.     string $currentTool,
  185.     int    $extendValue,
  186.     string $extendValueCallback
  187. )
  188. {
  189.     //
  190.     //    Stamp Profile frameLayout
  191.     //
  192.     jasperStampProfileCallback( $jasperCommand, $parent, $currentTool );
  193.  
  194.  
  195.     //
  196.     //    Operation frameLayout
  197.     //
  198.     radioButtonGrp -e
  199.         -on1 ($jasperCommand + " -e -edittype \"absolute\" `currentCtx`")
  200.         -on2 ($jasperCommand + " -e -edittype \"additive\" `currentCtx`")
  201.         -on3 ($jasperCommand + " -e -edittype \"scale\" `currentCtx`")
  202.         -on4 ($jasperCommand + " -e -edittype \"smooth\" `currentCtx`")
  203.         op0Radio;
  204.  
  205.  
  206.     //
  207.     //    Weight Painting frameLayout
  208.     //
  209.     floatSliderGrp -e
  210.         -cc ($jasperCommand + " -e -offset #1 `currentCtx`")
  211.         ptOffset;
  212.     floatSliderGrp -e
  213.         -cc ($jasperCommand + " -e -mult #1 `currentCtx`")
  214.         ptMult;
  215.  
  216.  
  217.     //
  218.     //    Clamping frameLayout
  219.     //
  220.     radioButtonGrp -e
  221.         -on1 ($jasperCommand + " -e -clamp \"none\" `currentCtx`")
  222.         -on2 ($jasperCommand + " -e -clamp \"both\" `currentCtx`")
  223.         -on3 ($jasperCommand + " -e -clamp \"lower\" `currentCtx`")
  224.         -on4 ($jasperCommand + " -e -clamp \"upper\" `currentCtx`")
  225.         clampRadio;
  226.  
  227.     floatSliderGrp -e
  228.         -cc ($jasperCommand + " -e -clamplower #1 `currentCtx`")
  229.         clLower;
  230.     floatSliderGrp -e
  231.         -cc ($jasperCommand + " -e -clampupper #1 `currentCtx`")
  232.         clUpper;
  233.     
  234. // OBSOLETE
  235. /*
  236.     if ( $currentTool == "wtPaint" ) {
  237.         textScrollList -e
  238.             -sc ("weightScrollListClick " + $jasperCommand )                   
  239.         weightScrollList;
  240.     }
  241. */
  242.  
  243.     if( $extendValue )
  244.     {
  245.         string $cmd = $extendValueCallback + " " + $jasperCommand + " "
  246.             + $parent + " "    + $currentTool;
  247.         eval $cmd;
  248.     }
  249. }
  250.  
  251.  
  252. // OBSOLETE
  253. /*
  254. global proc weightScrollListClick(
  255.     string $jasperCommand
  256. )
  257. {
  258.     string $clusterNames[] = eval("textScrollList -q -si weightScrollList");
  259.     string $name = $clusterNames[0];
  260.  
  261.     string $cmd = $jasperCommand + " -e -setnodename " + $name + " `currentCtx`";
  262.     eval( $cmd );
  263. }
  264. */
  265.  
  266.  
  267. proc jasperStrokeCallback( 
  268.     string $jasperCommand,
  269.     string $currentTool
  270. )
  271. {        
  272.     //
  273.     //    Reflect Paint frameLayout
  274.     //
  275.     updateReflectionChBox( $jasperCommand );
  276.     checkBoxGrp -e
  277.         -cc1 ($jasperCommand + " -e -reflectpaint #1 `currentCtx`" )
  278.         reflectStrokeChkBox;
  279.  
  280.     radioButtonGrp -e
  281.          -on1 ($jasperCommand + " -e -reflectpainttype \"reflectU\" `currentCtx`") 
  282.         refPaint0Radio;
  283.     radioButtonGrp -e
  284.          -on1 ($jasperCommand + " -e -reflectpainttype \"reflectV\" `currentCtx`") 
  285.         refPaint1Radio;
  286.     if ( $currentTool != "paintColor" ) {
  287.         radioButtonGrp -e
  288.          -on1 ($jasperCommand + " -e -reflectpainttype \"reflectMult\" `currentCtx`") 
  289.         refPaint2Radio;
  290.     }
  291.  
  292.       floatSliderGrp -e
  293.         -cc ($jasperCommand + " -e -reflectalongu #1 `currentCtx`") 
  294.         singleUSlider;
  295.  
  296.       floatSliderGrp -e
  297.         -cc ($jasperCommand + " -e -reflectalongv #1 `currentCtx`")
  298.         singleVSlider;
  299.  
  300.     button -e 
  301.         -c ($jasperCommand + " -e -reflectalongu 0.5 `currentCtx`") 
  302.         reflectUButton;
  303.  
  304.     button -e 
  305.         -c ($jasperCommand + " -e -reflectalongv 0.5 `currentCtx`") 
  306.         reflectVButton;
  307.  
  308.     if ( $currentTool == "putty" ) {
  309.         checkBoxGrp -e
  310.             -cc1 ($jasperCommand + " -e -invertrefvector #1 `currentCtx`")
  311.             invertVectorChkBox;
  312.     }
  313.  
  314.  
  315.     //
  316.     //    Stylus Pressure frameLayout
  317.     //
  318.     radioButtonGrp -e
  319.         -on1 ($jasperCommand + " -e -pressure \"none\" `currentCtx`")
  320.         -on2 ($jasperCommand + " -e -pressure \"opacity\" `currentCtx`")
  321.         -on3 ($jasperCommand + " -e -pressure \"radius\" `currentCtx`")
  322.         -on4 ($jasperCommand + " -e -pressure \"both\" `currentCtx`")
  323.         pressure0Radio;
  324.  
  325.  
  326.     //
  327.     //    Profile Alignment frameLayout
  328.     //
  329.     radioButtonGrp -e
  330.         -on1 ($jasperCommand + " -e -crt \"utangent\" `currentCtx`")
  331.         -on2 ($jasperCommand + " -e -crt \"vtangent\" `currentCtx`")
  332.         compRef0Radio;
  333.     radioButtonGrp -e
  334.         -on1 ($jasperCommand + " -e -crt \"upvector\" `currentCtx`")
  335.         -on2 ($jasperCommand + " -e -crt \"pathvector\" `currentCtx`")
  336.         compRef1Radio;
  337. }
  338.  
  339.  
  340. proc jasperSeamCallback( 
  341.     string $jasperCommand,
  342.     string $currentTool
  343. )
  344. {
  345.     // display only if nurbs are present
  346.     // 
  347.     updateSeamProperties( $jasperCommand );
  348.  
  349.  
  350.     if ( $currentTool == "putty" || $currentTool == "wtPaint" 
  351.          || $currentTool == "userPaint" || $currentTool == "attrPaint" 
  352.          || attrPaintInstCheckTool($currentTool) ) 
  353.     {
  354.  
  355.         //
  356.         //    Brush Mode frameLayout
  357.         //
  358.         radioButtonGrp -e
  359.             -on1 ($jasperCommand + " -e -brushoperate \"paint\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand )
  360.             -on2 ($jasperCommand + " -e -brushoperate \"selectedge\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand )
  361.             -on3 ($jasperCommand + " -e -brushoperate \"selectcorner\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand )
  362.             brushOperationType;
  363.  
  364.         //
  365.         //    Seam AutoCreation frameLayout
  366.         //
  367.         floatSliderGrp -e
  368.             -cc ($jasperCommand + " -e -commedgetol #1 `currentCtx`")
  369.             commEdgesTol;
  370.         
  371.         floatSliderGrp -e
  372.             -cc ($jasperCommand + " -e -commedgeminlength #1 `currentCtx`")
  373.             commEdgesMinLength;
  374.  
  375.         //
  376.         //    Common Edge/Corner frameLayout
  377.         //
  378.         radioButtonGrp -e
  379.             -on1 ($jasperCommand + " -e -commedgedisplay \"off\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand ) 
  380.             commEdgesDisplay0;
  381.         radioButtonGrp -e
  382.             -on1 ($jasperCommand + " -e -commedgedisplay \"one\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand ) 
  383.         commEdgesDisplay1;
  384.         radioButtonGrp -e
  385.             -on1 ($jasperCommand + " -e -commedgedisplay \"all\" `currentCtx`; updateCommEdgeDisplayScreen " + $jasperCommand ) 
  386.             commEdgesDisplay2;
  387.         
  388.         button -e
  389.             -c ($jasperCommand + " -e -commedgedisplaynext `currentCtx`; updateCommEdgeOneDisplayScreen " + $jasperCommand ) 
  390.             commEdgeDisplayOneNext;
  391.         button -e
  392.         -c ($jasperCommand + " -e -commedgedisplayprev `currentCtx`; updateCommEdgeOneDisplayScreen " + $jasperCommand ) 
  393.             commEdgeDisplayOnePrev;
  394.         
  395.         radioButtonGrp -e
  396.             -on1 ($jasperCommand + " -e -ccd \"off\" `currentCtx` " ) 
  397.             commCornerDisplay0;
  398.         
  399.         radioButtonGrp -e
  400.             -on1 ($jasperCommand + " -e -ccd \"all\" `currentCtx` " ) 
  401.             commCornerDisplay1;
  402.     }
  403.  
  404.     floatSliderGrp -e
  405.         -cc ($jasperCommand + " -e -collapsecvtol #1 `currentCtx`")
  406.         collapseCVTol;
  407.  
  408.     //
  409.     //    Stitching Mode frameLayout
  410.     //        - this is only displayed in the puttyContext
  411.     //
  412.     if ( $currentTool == "putty" ) {
  413.  
  414.         radioButtonGrp -e
  415.             -on1 ($jasperCommand + " -e -stitchtype \"off\" `currentCtx`")
  416.             -on2 ($jasperCommand + " -e -stitchtype \"pos\" `currentCtx`")
  417.             -on3 ($jasperCommand + " -e -stitchtype \"tan\" `currentCtx`")
  418.             stitchTypeRadio;
  419.  
  420.         checkBoxGrp -e
  421.             -cc1 ($jasperCommand + " -e -stitchcorner #1 `currentCtx`")
  422.             stitchCornerChkBox;
  423.  
  424.         checkBoxGrp -e
  425.             -cc1 ($jasperCommand + " -e -polecv #1 `currentCtx`")
  426.             stitchPoleCVChkBox;
  427.  
  428.         button -e
  429.             -c ($jasperCommand + " -e -stitchedgeflood `currentCtx`" )
  430.             stitchNowButton;
  431.     }
  432.     //
  433.     // Common Edge Value Averaging
  434.     // - this is only displayed if we are in wtPaint or userPaint
  435.     //
  436.     else if ( $currentTool == "wtPaint" || $currentTool == "userPaint"
  437.               || $currentTool == "attrPaint"
  438.               || attrPaintInstCheckTool( $currentTool ) )
  439.     {
  440.         checkBoxGrp -e
  441.             -cc1 ($jasperCommand + " -e -averageedges #1 `currentCtx`")
  442.             averageEdgeValues;
  443.  
  444.         checkBoxGrp -e
  445.             -cc1 ($jasperCommand + " -e -averagepolecv #1 `currentCtx`")
  446.             averagePoleCVValues;
  447.     }
  448. }
  449.  
  450.  
  451.  
  452. proc jasperMaskCallback( 
  453.     string $jasperCommand 
  454. )
  455. {
  456.     //
  457.     //    CV Mask frameLayout
  458.     //
  459.     radioButtonGrp -e
  460.         -on1 ($jasperCommand + " -e -maskcv \"off\" `currentCtx`")
  461.         -on2 ($jasperCommand + " -e -maskcv \"select\" `currentCtx`")
  462.         -on3 ($jasperCommand + " -e -maskcv \"unselect\" `currentCtx`")
  463.         cvMaskType;
  464.  
  465.     checkBoxGrp -e
  466.         -cc1 ($jasperCommand + " -e -displaycv #1 `currentCtx`")
  467.         cvMaskDisplay;
  468. }
  469.  
  470.  
  471. proc string imageDirectoryName( )
  472. {
  473. //     string $dirNames[] = `workspace -q -rt`;
  474. //     string $imageDir   = `workspace -q -fn`;
  475.  
  476. //     for ($i=0; $i < size($dirNames); ++$i) {
  477. //         if ( $dirNames[$i] == "sourceImages" ) {
  478. //             if ( ( $i+1 < size($dirNames) )  && ( $dirNames[$i+1] != "images" ) ) {
  479. //                 $imageDir = $imageDir + "/" + $dirNames[$i+1];    
  480. //             }
  481. //             break;
  482. //         }
  483. //     }
  484.     string $imageDir   = `workspace -q -fn`;
  485.  
  486.     return $imageDir;
  487. }
  488.  
  489.  
  490. global proc int jasperImportAttributeMapCB(
  491.     string $jasperCommand,
  492.     string $fileName,
  493.     string $fileType
  494. )
  495. {
  496.     // display the file name in the text field
  497.     textFieldGrp -e -fileName $fileName importMapNameField;
  498.     updateReloadButton( $jasperCommand );
  499.  
  500.     // execute the jasper command to load the file
  501.     string $dirName = imageDirectoryName();
  502.  
  503.     eval($jasperCommand + " -e -importfilename \"" + $fileName + "\" `currentCtx`");
  504.     eval($jasperCommand + " -e -importfileload \"" + $dirName + "\" `currentCtx`");
  505.  
  506.     // return true to close the filebrowser
  507.     return true;
  508. }
  509.  
  510. global proc int jasperExportAttributeMapCB(
  511.     string $jasperCommand,
  512.     string $fileName,
  513.     string $fileType
  514. )
  515. {
  516.     // display the file name in the text field
  517.     textFieldGrp -e -fileName $fileName exportMapNameField;
  518.     updateResaveButton( $jasperCommand );
  519.  
  520.     // execute the jasper command to load the file
  521.     string $dirName = imageDirectoryName();
  522.  
  523.     eval($jasperCommand + " -e -exportfilename \"" + $fileName + "\" `currentCtx`");
  524.     eval($jasperCommand + " -e -exportfilesave \"" + $dirName + "\" `currentCtx`");
  525.  
  526.     // return true to close the filebrowser
  527.     return true;
  528. }
  529.  
  530.  
  531. global proc jasperImportMapDialog( 
  532.     string $jasperCommand 
  533. {
  534.     string $cmd = ($jasperCommand + " -q -workspaceisset `currentCtx`" ); 
  535.     int  $isSet = eval( $cmd );
  536.     if ( $isSet == 0 ) {
  537.         string  $workspace = `workspace -q -fn`;
  538.         setWorkingDirectory $workspace "image" "sourceImages";
  539.  
  540.         // set the workspace is set to true
  541.         eval($jasperCommand + " -e -workspaceisset 1 `currentCtx`" );
  542.     }
  543.     
  544.     string $callback = "jasperImportAttributeMapCB " + $jasperCommand + " ";
  545.     fileBrowser( $callback, "Import", "image", 0 );
  546. }
  547.  
  548.  
  549. global proc jasperExportMapDialog( 
  550.     string $jasperCommand 
  551. {
  552.     string $cmd = ($jasperCommand + " -q -workspaceisset `currentCtx`" ); 
  553.     int    $isSet = eval( $cmd );
  554.     if ( $isSet == 0 ) {
  555.         string  $workspace = `workspace -q -fn`;
  556.         setWorkingDirectory $workspace "image" "sourceImages";
  557.  
  558.         // set the workspace is set to true
  559.         eval($jasperCommand + " -e -workspaceisset 1 `currentCtx`" );
  560.     }
  561.     
  562.     string $callback = "jasperExportAttributeMapCB " + $jasperCommand + " ";
  563.     fileBrowser( $callback, "Export", "map", 1 );
  564. }
  565.  
  566. global proc jasperImportReloadMap( 
  567.     string $jasperCommand 
  568. {
  569.     string $fileName = eval("textFieldGrp -q -fileName importMapNameField");
  570.     if ( $fileName != "" ) {
  571.         string $dirName = imageDirectoryName();
  572.         eval($jasperCommand + " -e -importfileload \"" + $dirName + "\" `currentCtx`");    
  573.     }
  574. }
  575.  
  576. global proc jasperExportReloadMap( 
  577.     string $jasperCommand 
  578. {
  579.     string $fileName = eval("textFieldGrp -q -fileName exportMapNameField");
  580.     if ( $fileName != "" ) {
  581.         string $dirName = imageDirectoryName();
  582.         eval($jasperCommand + " -e -exportfilesave \"" + $dirName + "\" `currentCtx`");
  583.     }
  584. }
  585.  
  586. global proc importFileLoad(
  587.     string $jasperCommand
  588. )
  589. {
  590.     // change the reload button if necessary
  591.     updateReloadButton( $jasperCommand );
  592.  
  593.     string $fileName = eval("textFieldGrp -q -fileName importMapNameField");
  594.     if ( $fileName != "" ) {
  595.         // execute the jasper command to load the file
  596.         string $dirName = imageDirectoryName();
  597.         eval($jasperCommand + " -e -importfilename \"" + $fileName + "\" `currentCtx`");
  598.         eval($jasperCommand + " -e -importfileload \"" + $dirName + "\" `currentCtx`");
  599.     }
  600. }
  601.  
  602. global proc exportFileSave(
  603.     string $jasperCommand
  604. )
  605. {
  606.     // change the resave button if necessary
  607.     updateResaveButton( $jasperCommand );
  608.  
  609.     string $fileName = eval("textFieldGrp -q -fileName exportMapNameField");
  610.     if ( $fileName != "" ) {
  611.         // execute the jasper command to save the file
  612.         string $dirName = imageDirectoryName();
  613.         eval($jasperCommand + " -e -exportfilename \"" + $fileName + "\" `currentCtx`");
  614.         eval($jasperCommand + " -e -exportfilesave \"" + $dirName + "\" `currentCtx`");
  615.     }
  616. }
  617.  
  618.  
  619. proc jasperMapCallback( 
  620.     string $jasperCommand,
  621.     string $currentTool
  622. )
  623. {
  624.     //
  625.     //    Import Map frameLayout
  626.     //
  627.     textFieldGrp -e
  628.         -cc ($jasperCommand + " -e -importfilename \"#1\" `currentCtx`; importFileLoad " + $jasperCommand )
  629.         importMapNameField;
  630.  
  631.     button -e 
  632.         -c ( "jasperImportReloadMap \"" + $jasperCommand + "\"" ) 
  633.         importReloadButton;
  634.  
  635.     button -e 
  636.         -c ( "jasperImportMapDialog \"" + $jasperCommand + "\"" ) 
  637.         importMapButton;
  638.  
  639.     checkBoxGrp -e
  640.         -cc1 ($jasperCommand + " -e -importreassign #1 `currentCtx`" ) 
  641.         reassignMapsChkBox;
  642.  
  643.     radioButtonGrp -e
  644.         -on1 ($jasperCommand + " -e -importfilemode \"alpha\" `currentCtx`")
  645.         -on2 ($jasperCommand + " -e -importfilemode \"luminance\" `currentCtx`")
  646.         importMapAlphaValueRadio1;
  647.  
  648.     radioButtonGrp -e
  649.         -on1 ($jasperCommand + " -e -importfilemode \"red\" `currentCtx`")
  650.         -on2 ($jasperCommand + " -e -importfilemode \"green\" `currentCtx`")
  651.         -on3 ($jasperCommand + " -e -importfilemode \"blue\" `currentCtx`")
  652.         importMapAlphaValueRadio2;
  653.  
  654.     if ( attrPaintInstCheckTool($currentTool) ) {
  655.         string $name = eval("attrPaintCtx -q -bcn `currentCtx`");
  656.         if ( $name == "polyClrVertPaint" ) {
  657.             radioButtonGrp -e
  658.                 -on1 ($jasperCommand + " -e -importfilemode \"rgb\" `currentCtx`")
  659.                 -on2 ($jasperCommand + " -e -importfilemode \"rgba\" `currentCtx`")
  660.                 importMapAlphaValueRadio3;
  661.         }
  662.     }
  663.  
  664.  
  665.     if ( $currentTool == "selectPaint" ) {
  666.         floatSliderGrp -e
  667.             -cc ($jasperCommand + " -e -importthreshold #1 `currentCtx`" )    
  668.         importSelectCVThresholdSlider;
  669.     }
  670.  
  671.     //
  672.     //    Export Map frameLayout
  673.     //
  674.     if ( ( $currentTool == "wtPaint" )  || 
  675.          ( $currentTool == "userPaint") ||
  676.          ( $currentTool == "attrPaint") ||
  677.          ( attrPaintInstCheckTool( $currentTool ) ) ||
  678.          ( $currentTool == "selectPaint" ) ) 
  679.     {
  680.         textFieldGrp -e
  681.             -cc ($jasperCommand + " -e -exportfilename \"#1\" `currentCtx`; exportFileSave " + $jasperCommand )
  682.             exportMapNameField;
  683.  
  684.         button -e 
  685.             -c ( "jasperExportReloadMap \"" + $jasperCommand + "\"" ) 
  686.             exportReloadButton;
  687.  
  688.         button -e 
  689.             -c ( "jasperExportMapDialog \"" + $jasperCommand + "\"" ) 
  690.             exportMapButton;
  691.  
  692.         // determine if this is 3d or 1d paint
  693.         //
  694.         string $name = "";
  695.         if ( attrPaintInstCheckTool($currentTool) ) {
  696.             $name = eval("attrPaintCtx -q -bcn `currentCtx`");
  697.         }
  698.     
  699.         // if this is not 3d color paint tool (1d case)
  700.         // 
  701.         if ( $name != "polyClrVertPaint" ) {
  702.             radioButtonGrp -e
  703.                 -on1 ($jasperCommand + " -e -exportfilemode \"alpha\" `currentCtx`")
  704.                 -on2 ($jasperCommand + " -e -exportfilemode \"luminance\" `currentCtx`")
  705.                 exportMapValueRadio1;
  706.         } else {
  707.             radioButtonGrp -e
  708.                 -on1 ($jasperCommand + " -e -exportfilemode \"alpha\" `currentCtx`")
  709.                 -on2 ($jasperCommand + " -e -exportfilemode \"rgb\" `currentCtx`")
  710.                 -on3 ($jasperCommand + " -e -exportfilemode \"rgba\" `currentCtx`")
  711.                 exportMapValueRadio2;
  712.         }
  713.  
  714.         intSliderGrp -e
  715.             -cc ($jasperCommand + " -e -exportfilesizex #1 `currentCtx`; adjustMapSizeSlider " + $jasperCommand + " " + "xSlider")
  716.             exportMapSizeXSlider;
  717.  
  718.         intSliderGrp -e
  719.             -cc ($jasperCommand + " -e -exportfilesizey #1 `currentCtx`; adjustMapSizeSlider " + $jasperCommand + " " + "ySlider")
  720.             exportMapSizeYSlider;
  721.  
  722.         checkBoxGrp -e
  723.             -cc1 ("setAspectRatio " + $jasperCommand ) 
  724.             exportKeepAspectChkBox;
  725.  
  726.         optionMenuGrp -e
  727.             -cc ($jasperCommand + " -e -exportfiletype \"#1\" `currentCtx`")
  728.             imageFormatOptionMenu;
  729.     }
  730. }
  731.  
  732.  
  733. proc jasperDisplayCallback( 
  734.     string $jasperCommand,
  735.     string $currentTool
  736. )
  737. {
  738.     // 
  739.     //    Surface frameLayout
  740.     //    
  741.     string $currentContext  = `currentCtx`;
  742.  
  743.     checkBoxGrp -e
  744.         -cc1 ($jasperCommand + " -e -outline #1 `currentCtx`; updateBrushFeedback " + $jasperCommand )
  745.         drawOutlineChkBox;
  746.  
  747.     checkBoxGrp -e
  748.         -cc1 ($jasperCommand + " -e -brushfeedback #1 `currentCtx`" )
  749.         brushFeedbackChkBox;
  750.  
  751.     checkBoxGrp -e
  752.         -cc1 ($jasperCommand + " -e -outlinepaint #1 `currentCtx`; updateBrushFeedback " + $jasperCommand )
  753.         drawOutlinePaintingChkBox;
  754.  
  755.     checkBoxGrp -e
  756.         -cc1 ($jasperCommand + " -e -showactive #1 `currentCtx`")
  757.         showActiveLinesChkBox;
  758.  
  759.     //
  760.     //    Color feedback frameLayout
  761.     //        - this is only displayed for wtPaint and userPaint tools
  762.     //
  763.     if ( ( $currentTool == "wtPaint" ) || ( $currentTool == "userPaint")
  764.          || $currentTool == "attrPaint" || attrPaintInstCheckTool( $currentTool ) )
  765.     {
  766.         checkBoxGrp -e
  767.             -cc1 ($jasperCommand + " -e -colorfeedback #1 `currentCtx`")
  768.             colorFeedbackChkBox;
  769.         checkBoxGrp -e
  770.             -cc1 ($jasperCommand + " -e -disablelighting #1 `currentCtx`")
  771.             disableLightingChkBox;
  772.         if ( $currentTool == "wtPaint" ) {
  773.             checkBoxGrp -e
  774.                 -cc1 ($jasperCommand + " -e -usesetcolor #1 `currentCtx`")
  775.                 useSetColorChkBox;
  776.         }
  777.  
  778.         floatSliderGrp -e
  779.             -cc ($jasperCommand + " -e -colorrangelower #1 `currentCtx`")
  780.             crLower;
  781.         floatSliderGrp -e
  782.             -cc ($jasperCommand + " -e -colorrangeupper #1 `currentCtx`")
  783.             crUpper;
  784.     }
  785.  
  786.     if ( $currentTool == "setEditPaint" ) {
  787.         checkBoxGrp -e
  788.             -cc1 ($jasperCommand + " -e -setcolorfeedback #1 `currentCtx`" )
  789.             setEditColorFeedbackChkBox;
  790.  
  791.         checkBoxGrp -e
  792.             -cc1 ($jasperCommand + " -e -setdisplaycvs #1 `currentCtx`" )
  793.             setEditDisplayCVsChkBox;
  794.     }
  795. }
  796.  
  797.  
  798. proc jasperMiscCallback( 
  799.     string $jasperCommand 
  800. )
  801. {
  802.     string $currentContext  = `currentCtx`;
  803.     string $currentTool = `contextInfo -c $currentContext`;
  804.  
  805.     // 
  806.     // Multiple Surface Detection frameLayout
  807.     //
  808.     radioButtonGrp -e
  809.         -on1 ($jasperCommand + " -e -multisurface \"infinite\" `currentCtx`; updateInFinite " + $jasperCommand ) 
  810.          -on2 ($jasperCommand + " -e -multisurface \"finite\" `currentCtx`; updateFinite " + $jasperCommand ) 
  811.         multiSurfaceRadio;
  812.  
  813.       intSliderGrp -e
  814.         -cc ($jasperCommand + " -e -multisurfacesize #1 `currentCtx`")
  815.         multiSurfaceSizeSlider;
  816.  
  817.     checkBoxGrp -e
  818.         -cc1 ($jasperCommand + " -e -multisurfacemode #1 `currentCtx`" )
  819.         multiSurfaceModeChkBox;
  820.     updateMultiSurfaceModeChkBox( $jasperCommand );
  821.  
  822.  
  823.     //
  824.     //    Stamp Compensation frameLayout
  825.     //
  826.     radioButtonGrp -e
  827.         -on1 ($jasperCommand + " -e -compensate \"none\" `currentCtx`")
  828.         comp0Radio;
  829.     radioButtonGrp -e
  830.         -on1 ($jasperCommand + " -e -compensate \"linear\" `currentCtx`")
  831.         comp1Radio;
  832.     radioButtonGrp -e
  833.         -on1 ($jasperCommand + " -e -compensate \"grid\" `currentCtx`")
  834.         comp2Radio;
  835.  
  836.     intSliderGrp -e
  837.         -cc ($jasperCommand + " -e -compgridradius #1 `currentCtx`")
  838.         compGridRadius;
  839.  
  840.     //
  841.     //    Paint Type frameLayout
  842.     //
  843.     radioButtonGrp -e
  844.         -on1 ($jasperCommand + " -e -painttype \"projective\" `currentCtx`")
  845.         paintType0Radio;
  846.     radioButtonGrp -e
  847.         -on1 ($jasperCommand + " -e -painttype \"texture\" `currentCtx`")
  848.         paintType1Radio;
  849.     updateReflectionChBox( $jasperCommand );
  850.     updateStampCompensation( $jasperCommand );
  851.  
  852.  
  853.     //
  854.     //    Stroke Smoothing frameLayout
  855.     //
  856.     checkBoxGrp -e
  857.         -cc1 ($jasperCommand + " -e -tsmoothing #1 `currentCtx`")
  858.         texSmoothChkBox;
  859.     checkBoxGrp -e
  860.         -cc1 ($jasperCommand + " -e -ssmoothing #1 `currentCtx`")
  861.         screenSmoothChkBox;
  862.      intSliderGrp -e
  863.         -cc  ($jasperCommand + " -e -ssmoothingiters #1 `currentCtx`")
  864.         divisionSlider;
  865.  
  866.  
  867.     // Pre and Post stroke command frameLayout
  868.     //
  869.     textFieldGrp -e
  870.         -cc ($jasperCommand + " -e -bsc \"#1\" `currentCtx`")
  871.         preStrokeTextField;
  872.     textFieldGrp -e
  873.         -cc ($jasperCommand + " -e -asc \"#1\" `currentCtx`")
  874.         postStrokeTextField;
  875. }
  876.  
  877.  
  878. //
  879. // $jasperMode == "putty", "wtPaint" "userPaint" "selectPaint" 
  880. // $section    == "sculpt"/"weight"/"select"/"script", "stroke"
  881. //                "seam", "mask", "file", "display", "misc"
  882. //
  883. global proc jasperCallback( string $jasperCommand,
  884.                             string $section,
  885.                             string $parent,
  886.                             string $colorSliderCB )
  887. {
  888.  
  889.     string $currentContext  = `currentCtx`;
  890.     string $currentTool     = `contextInfo -c $currentContext`;
  891.  
  892. // OBSOLETE
  893. /*
  894.     if ( $section == "Paint" ) {
  895.         paintColorTabCallback( $jasperCommand, $parent, $currentTool );
  896.     } 
  897.     else if ( $section == "File_Textures" ) {
  898.         paintColorFileCallback( $jasperCommand );
  899.     } 
  900.     else if( $section == "Weight" ) {
  901.         jasperValueCallback( $jasperCommand, $parent, $currentTool, false, "" );
  902.     } 
  903.     else if( $section == "Attr" ) { 
  904.         jasperAttrCallback( $jasperCommand, $currentTool );
  905.     }
  906. */
  907.  
  908.     if( $section == "Sculpt" ) {
  909.         jasperSculptCallback( $jasperCommand, $parent, $currentTool );
  910.     } 
  911. //     else if( $section == "Script_Paint" || $section == "Attr__Paint" ) {
  912.     else if( $section == "Script_Paint" )
  913.     {
  914.         jasperValueCallback( $jasperCommand, $parent, $currentTool, false, "" );
  915.     } 
  916.     else if( $section == "Select" ) {
  917.         jasperSelectCallback( $jasperCommand, $parent, $currentTool);
  918.     } 
  919.     else if( $section == "SetMembership" ) {
  920.         jasperSetEditCallback( $jasperCommand, $parent, $currentTool);
  921.     } 
  922.     else if( $section == "Stroke" ) { 
  923.         jasperStrokeCallback( $jasperCommand, $currentTool );
  924.     }
  925.     else if( $section == "Seam" ) { 
  926.         jasperSeamCallback( $jasperCommand, $currentTool );
  927.     }
  928.     else if( $section == "Mask" ) { 
  929.         jasperMaskCallback( $jasperCommand );
  930.     }
  931.     else if( $section == "Map" ) { 
  932.         jasperMapCallback( $jasperCommand, $currentTool );
  933.     }
  934.     else if( $section == "Display" ) { 
  935. // OBSOLETE
  936. /*
  937.         if ( $currentTool == "paintColor" ) {
  938.             paintColorDisplayCallback( $jasperCommand );
  939.         } else {
  940. */
  941.         jasperDisplayCallback( $jasperCommand, $currentTool );
  942.     }
  943.     else if( $section == "Misc" ) { 
  944. // OBSOLETE
  945. /*
  946.         if ( $currentTool == "paintColor" ) {
  947.             paintColorMiscCallback( $jasperCommand );
  948.         } else {
  949. */
  950.         jasperMiscCallback( $jasperCommand );
  951.     }
  952.     else if( $section == "Setup" ) { 
  953.         jasperSetupCallback( $jasperCommand );
  954.     }
  955.     else {
  956.         attrPaintInstCallbackDefine( 
  957.                 $jasperCommand, $parent, $currentTool, $section 
  958.         );
  959.     }
  960. }
  961.